package com.sky.mapper.admin;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.enumeration.OperationType;
import com.sky.pojo.Setmeal;
import com.sky.vo.SetmealVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface SetmealMapper {

    /**
     * 根据分类id查询套餐的数量
     * @param id
     * @return
     */
    //@Select("select count(id) from setmeal where category_id = #{categoryId}")
    Integer countByCategoryId(List<Long> id);

    Page<Setmeal> findByPage(SetmealPageQueryDTO setmealPageQueryDTO);

    SetmealVO findById(Long id);

    //@AutoFill(OperationType.UPDATE)
    int updateSetmeal(Setmeal setmeal);

    @Update("update setmeal set status = #{status} where id = #{id}")
    int updateStatus(@Param("status") Integer status, @Param("id") Long id);

    int delectByIds(List<Long> ids);

    @Select("select  *  from setmeal where id = #{id}")
    Setmeal getById(Long id);

    int deleteSetmealDish(List<Long> ids);

    int addSetmeal(Setmeal setmeal);

}
